﻿
Ext.namespace('FantastPlatform', 'FantastPlatform.UI');


FantastPlatform.UI.FlowElementForm = function (config) {
    Ext.apply(this, config);
    

  
    this.items = [{
        layout: 'column',
        border: false,
        labelSeparator: '：',
        items: [{
                    columnWidth: 1,
                    border: false,
                    layout: 'form',
                    items: [new Ext.form.TextField({
                        fieldLabel: '参与部门',
                        name: 'Organization',
                        allowBlank: false,
                        blankText: " 名称不能为空",
                        anchor: '90%'
                    })]
                },{
                    columnWidth: 1,
                    border: false,
                    layout: 'form',
                    items: [new Ext.form.TextField({
                        fieldLabel: '出动人数',
                        name: 'PersonNumber',
                        allowBlank: false,
                        blankText: " 详情不能为空",                      
                        anchor: '90%'
                    })]
                }, {
                    columnWidth: 1,
                    border: false,
                    layout: 'form',
                    items: [new Ext.form.TextField({
                        fieldLabel: '梯队',
                        name: 'EchelonNumber',
                        allowBlank: false,                       
                        blankText: " 梯队数量不能为空"
                    })]
                }, {
                    columnWidth: 1,
                    border: false,
                    layout: 'form',
                    items: [new Ext.form.TextArea({
                        fieldLabel: '任务',
                        name: 'Details',
                        allowBlank: false,
                        blankText: " 任务不能为空",
                        height: 100,
                        anchor: '90%'
                    })]
                }, {
                    columnWidth: 1,
                    border: false,
                    layout: 'form',
                    items: [new Ext.form.TextArea({
                        fieldLabel: '装备',
                        name: 'Equip',
                        allowBlank: true,                       
                        height: 50,
                        anchor: '90%'
                    })]
                }, {
                    columnWidth: 1,
                    border: false,
                    layout: 'form',
                    items: [new Ext.form.TextArea({
                        fieldLabel: '要求',
                        name: 'Require',
                        allowBlank: true,                       
                        height: 50,
                        anchor: '90%'
                    })]
                }]
    }];

    FantastPlatform.UI.FlowElementForm.superclass.constructor.call(this, {
        bodyStyle: 'padding:5px',
        collapsible: true,
        labelAlign: 'right',
        autoScroll: true,
        border: false
    });
};

Ext.extend(FantastPlatform.UI.FlowElementForm, Ext.form.FormPanel, {
    onRender: function (ct, position) {
        FantastPlatform.UI.FlowElementForm.superclass.onRender.call(this, ct, position);
        if (this.Id && this.Id != 0) {
            this.add(new Ext.form.Hidden({ name: 'Id', value: this.Id }));
            var Form = this.form;
            this.form.load({
                url: '../Service/FlowElementViewService.aspx?Action=Get',
                params: { id: this.Id },
                waitMsg: '正在读取数据...',
                waitTitle: '请稍后...',
                failure: function (form, action) {
                    if (action.failureType != 'client') {
                        showErrorMessage('操作失败', action.result.message, '');
                    }
                },
                success: function (form, action) {
                }
            });
        }
    }
});

